
#module out_logic

#deffunc on_out_logic
//	s𒲂ׂtH_PATH
	PATH=dir_cur
	
//	FILEǏʕ\pmesboxp
	to_MB=""
//	ChJ[hmesboxp
	to_sel_MB=""

//	ID0wnd
	screen 0,640,480
//	̃{^ƂЂFILE\
	button "FILEI",*get_files
	pos 70,0
//	buttonƃtH_I
	button "select",*select
	pos 140,0
//	buttonƌ݂̃tH_FILEꗗ\
	button "ꗗ",*show
	pos 0,24
//	ɑI𒆂PATH\
//	ɒړ͂ĂԂOK
	input PATH,480,24
//	inputID`
	#define ID_of_input 3
	pos 180,48
//	ׂs\pmesbox
	mesbox to_MB,460,332,0	
//	ʗpmesbox̒`
	#define ID_of_result 4
	pos 0,48
//	s𒲂ׂgqIchkbox
	mes "gqI"
	chkbox ".hsp",f_hsp
	chkbox ".as",f_as
	chkbox ".txt",f_txt
	chkbox ".hsh",f_hsh
	chkbox ".hss",f_hss
//	ChJ[h͗pmesbox
	mes "ChJ[h͗p"
	mesbox to_sel_MB,180,250,5
//	N゠炩FILEQ𒊏oď
	gosub *begin_write
	return
	
//	FILEꗗ\pTu[`
*show
	to_show=""
//	FILEꗗto_showɑ
	dirlist to_show,"*.*
//	ʕ\pmesboxdirlisťʂo
	gsel 0
	objprm ID_of_result,to_show
	stop
	
//	ׂtH_I
*select
//	FILEIdialoggp
	dialog "",16
//	Ԃlsɑ
	s=refstr
//	IFILẼfBNgssɑ
	ss=getpath(s,32)
//	IFILẼfBNginputboxɕ\
	gsel 0
	objprm ID_of_input,ss
	stop

//	ɍFILEQ
*get_files
	gosub *gqz
//	m[gpbhp
	to_note_on_get_files=""
	notesel to_note_on_get_files
//	gq̐JԂ
	repeat c_num
//	cs_tmp.cntɂ̓ChJ[h+gq`œĂ
//	cs_tmp.cntɂЂFILE𕶎`Ŏ擾
		dirlist dirbuf,cs_tmp.cnt
//	Zm[gpbh߂̑Ώۂ
		 to_note_on_get_files+=dirbuf
	loop
//	FILEQW܂̂Ŏ̏
	gosub *write_dat
	stop	

//	dFILE폜"files.dat"FILEQ
*write_dat
//	擾FILEQ\[g
//	sortnotehspda.as̖
	sortnote@ to_note_on_get_files,0
	s="":ss=""
*begin_of_for
	for i,0,(notemax-1),1
		noteget s,i
		noteget ss,(i+1)
//	݂̃m[gpbh̍sƎ̍sȂ
		if s==ss{
			notedel i
//	݂̃m[gpbh̍s폜
//	JԂŏȂ
			goto *begin_of_for
		}
	next
	gsel 0	
//	ʕ\pmesboxɂЂFILEQ\
	objprm ID_of_result,to_note_on_get_files
//	ЂFILEQ"files.dat"ɏ
	notesave "files.dat"
	return

//	NčŏFILEQ𒊏oď
*begin_write
//	m[gpbhp
	to_note_on_get_files=""
	notesel to_note_on_get_files
//	݂̃fBNg"*.hsp"FILE𒊏o
	dirlist dirbuf,"*.hsp"
	to_note_on_get_files+=dirbuf
//	dFILE폜"files.dat"FILEQރTu[`
	gosub *write_dat
	return
	
*gqz
//	s𒲂ׂiIԁjgq̐
	c_num=0
//	s𒲂ׂgqIchkboxONɂȂĂ+1
	if f_hsp==1:c_num++
	if f_as==1:c_num++
	if f_txt==1:c_num++
	if f_hsh==1:c_num++
	if f_hss==1:c_num++
//	s𒲂ׂiIԁjgq
//	`Ŋi[镶z
	sdim cs_tmp,c_num,256
	i=0
//	s𒲂ׂgqIchkboxONɂȂĂ
//	zɑ
	if f_hsp==1{cs_tmp.i="*.hsp":i++}
	if f_as==1 {cs_tmp.i="*.as" :i++}
	if f_txt==1{cs_tmp.i="*.txt":i++}
	if f_hsh==1{cs_tmp.i="*.hsh":i++}
	if f_hss==1{cs_tmp.i="*.hss":i++}
//	ChJ[h͗pmesbox̒gnotesel
	notesel to_sel_MB
//	m[gpbh擾p
	sss=""
//	m[gpbh̍sJԂ
	repeat notemax
//	m[gpbhsǂ݂
	noteget sss,cnt
//	ǂ݂ssȂ
	if sss!=""{
//	s𒲂ׂ̐+1
		c_num++
//	ׂɑ
		cs_tmp.i=sss
		i++
	loop
	return
	#global